import { createSlice } from '@reduxjs/toolkit'
import { IPublicInfo, IUserInfo } from '../reduxType'

const initialState: IPublicInfo = {
  userInfo: { userName: '游客', userAuth: 0 },
}
export const publicInfoSlice = createSlice({
  name: 'user',
  initialState: initialState,
  reducers: {
    // setUserInfo(){}

    setUserInfo: function (state, { payload }: { payload: IUserInfo }) {
      state.userInfo = payload
    },
  },
})

export const publicInfoActions = publicInfoSlice.actions

export default publicInfoSlice.reducer
